package edu.chen.enums;

/**
 * 登录状态的枚举类
 */

public enum  LoginStateEnum implements BasicEnum{
    SUCCESS(1, "登陆成功"),ERROR(0,"系统异常"),NOT_FOUND(-1,"用户不存在"),PSW_ERROR(-2,"密码错误");

    private int state;
    private String stateInfo;

    LoginStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public static LoginStateEnum stateOf(int index){
        for (LoginStateEnum stateEnum : values()){
            if(stateEnum.getState()  == index)
                return stateEnum;
        }
        return null;
    }
}
